package utils;

/**
 * 用于提供http 协议的头部信息
 */
public class ProtocolHeaderUtil {

    /**
     * 获取200 的响应头
     * @param contentLength
     * @return
     */
    public static String getHeader200(int contentLength){
        return "HTTP/1.1 200 OK \n"+
                "Content-Type: text/html \n"+
                "Content-length:"+contentLength+"\n"+
                "\r\n";
    }

    /**
     * 获取404 的响应头
     * @return
     */
    public static  String getHeader404(){
        String html ="<h1>404 not found</h1>";
        return "HTTP/1.1 200 OK \n"+
                "Content-Type: text/html \n"+
                "Content-length:"+html.length()+"\n"+
                "\r\n"+html;
    }
}
